Repository navigation
docs: explain empty reports when __coverage__ is created after load (#843) - #1014
Merged
jennifer-shehane merged 2 commits intoNov 2, 2026
Merged
Conversation
…843) Nuxt 3 with vite-plugin-istanbul only instruments lazily imported page modules, so window.__coverage__ is created after the page's load event. Versions before 4.1.2 read coverage only on load and wrote an empty out.json. 4.1.2 (#1007) also reads each page before it unloads and at the end of each test, and test-apps/swc-webpack guards that behavior. Add a Common issues entry so users still on 3.x who see the coverage object in DevTools but get an empty report know to upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WUv8r1DKMrtbUrcHzyPuof
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WUv8r1DKMrtbUrcHzyPuof
|
🎉 This PR is included in version 4.1.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
window.__coverage__object #843Additional details
I re-verified #843 against master using the reporter's public Nuxt 3 +
vite-plugin-istanbulrepro. The bug is already fixed in 4.1.2, so this PR only adds a README note to help people who still hit it on older versions.What caused it: the repro only instruments
pages/*andutils/*, and Nuxt imports page components lazily. On the Nuxt dev server,window.__coverage__was created after the page'sloadevent on every load I recorded (by 6–226 ms). Up to 4.1.1, the plugin read coverage only onwindow:loadand at the start of each test, before the test's owncy.visit. So it saw nothing and wrote an emptyout.json, even though DevTools showed the object.Why it's already fixed: #1007 (released in 4.1.2) also reads each page in
window:before:unloadand inafterEach. I compared the published 4.1.1 and 4.1.2 bundles to confirm the boundary.test-apps/swc-webpackalready guards this in CI: its only instrumented bundle is injected afterload, the same shape as the repro. So I didn't add another test app.Spec filtering isn't involved. I ran the repro's real coverage keys through
filterFilesFromCoveragewith itsspecPatternand support file, and both app files were kept.The change: a new Common issues entry, "
window.__coverage__exists but the report is empty". It names the symptom, explains the timing, and says to upgrade to 4.1.2 or later. It also links 3.x users to the 3.x to 4.x migration section, since that upgrade is breaking (Cypress ≥ 15.10,env→expose).Steps to test
README.md.#cypresscode-coverage-3x-to-4xlink jumps to the migration section (npx markdown-link-check README.mdreports it as ✓).npm run format:checkpasses. There are no code changes.How has the user experience changed?
No change to plugin behavior. The README has a new troubleshooting entry for this symptom.
Generated by Claude Code
Note
Low Risk
Documentation-only change with no code, config, or test modifications.
Overview
Adds a Common issues troubleshooting entry for when DevTools shows
window.__coverage__but.nyc_output/out.jsonstays empty. The note explains that lazy-loaded or hydration-time instrumentation can create the coverage object after the pageloadevent, which older plugin versions (before 4.1.2) did not capture because they only read coverage onloadand at test start.The section directs users to upgrade to 4.1.2+ (which also reads before unload and in
afterEach), points 3.x users at the existing migration anchor, and links issue #843. No runtime or plugin behavior changes—README only.Reviewed by Cursor Bugbot for commit 5792459. Bugbot is set up for automated code reviews on this repo. Configure here.